<template>
    <!--备注弹窗-->
    <el-dialog  :visible="dialogFormVisible" width="50%" @close="modecClose">
        <el-form :model="remarksForm">
            <div class="rTitle">
                <span>备注描述</span><br>
                <span>Note to describe：</span>
            </div>

            <el-form-item >
                <el-input  type="textarea" v-model="remarksForm.memo" :rows="6"
                           placeholder="请给出该常用物料单的备注描述。最多输入20字Please give a description of the common material list. Maximum of 20 words" ></el-input>
            </el-form-item>

        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="modecClose">关 闭</el-button>
            <el-button type="primary" @click="addMaterial">确 定</el-button>
        </div>
    </el-dialog>

</template>

<script>
import http from "../../../components/axios/fetch";
import { getApplyUpdate} from "../../../components/axios/url";
    export default {
        name: "remarksMode",
        props:{
            dialogFormVisible: null,
            id:''
        },
        data(){
            return{
                remarksForm:{
                    memo:''
                },
            }

        },

        methods:{
            //添加备注
            addMaterial(){
                let data = {
                    id: this.id,
                    oftenUse: 2,
                    memo: this.remarksForm.memo
                }
                try{
                    http.post(getApplyUpdate, data).then(res => {
                        if(res.data && res.data.resultMess === "success") {
                            this.modecClose(); // 关闭弹窗
                            this.$emit('getRecordList');
                        }
                    })
                } catch(error){
                    this.$notify.error({
                        title: '提示',
                        message: '网络错误',
                    });
                }

            },
            modecClose() {
                this.$emit('dialogFormVisibleClose');
            }
        }
    }
</script>

<style scoped>

</style>
